//
//  FukuanWebViewController.m
//  JimiPay
//
//  Created by yull on 16/1/7.
//  Copyright (c) 2016年 com.shengyun. All rights reserved.
//

#import "FukuanWebViewController.h"
#import "TDQuickQukuanViewController.h"

@interface FukuanWebViewController ()

@end

@implementation FukuanWebViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    self.navigationItem.title = @"收款";
    [self setupCustomBackItem];
    
    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.url]]];
//    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"HTTP://api.aifupos.com/mpcctp/ordsuccess.html"]]];
}

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
    
    NSString *url = [[request URL] absoluteString];
    if ([url isEqualToString:@"objc://withdraw"]) {
        TDQuickQukuanViewController *controller = [[TDQuickQukuanViewController alloc] init];
        controller.hidesBottomBarWhenPushed = YES;
        
        NSMutableArray *vcs = [NSMutableArray arrayWithArray:self.navigationController.viewControllers];
        [vcs removeLastObject];
        [vcs addObject:controller];
        [self.navigationController setViewControllers:vcs animated:YES];
        return NO;
    } else if ([url isEqualToString:@"objc://back"]) {
        [self.navigationController popToRootViewControllerAnimated:YES];
        return NO;
    }
    
    return YES;
}

@end
